package cn.jly.spring.boot.cloud.controller;

import cn.jly.boot.starter.service.AuthorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @author lanyangji
 * @description 测试自定义starter
 * @date 2020/12/11 下午 2:58
 */
@Controller
public class AuthorController {

    @Autowired
    AuthorService authorService;

    @ResponseBody
    @GetMapping("/author")
    public String authorService(Model model) {
        final Map<String, Object> map = model.asMap();
        System.out.println("map = " + map);

        // 获取指定的全局数据（这个在modelAttribute中定义）
        final Object beautyMap = map.get("beautyMap");
        System.out.println("beautyMap = " + beautyMap);

        return authorService.greet();
    }
}
